//
//  houxuTableViewCell.m
//  PASystem
//
//  Created by michael on 16/8/28.
//  Copyright © 2016年 czd. All rights reserved.
//

#import "houxuTableViewCell.h"

@implementation houxuTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
          self.selectionStyle = UITableViewCellSelectionStyleNone;
       self.selectionStyle = UITableViewCellSelectionStyleNone;
    
     _label1 = [[UILabel alloc]init];
    _label1.frame = CGRectZero;
    _label1.numberOfLines = 0;
      [_label1 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label1];
    
       _label2 = [[UILabel alloc]init];
    _label2.frame = CGRectZero;
    _label2.numberOfLines = 0;
    _label2.textAlignment = NSTextAlignmentRight;
      [_label2 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label2];
    
       _label3 = [[UILabel alloc]init];
    _label3.frame = CGRectZero;
      [_label3 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label3];
    
       _label4 = [[UILabel alloc]init];
    _label4.frame = CGRectZero;
    _label4.numberOfLines = 0;
    _label4.textAlignment = NSTextAlignmentRight;
      [_label4 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label4];
    
       _label5 = [[UILabel alloc]init];
    _label5.frame = CGRectZero;
      [_label5 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label5];
    
       _label6 = [[UILabel alloc]init];
    _label6.frame = CGRectZero;
      [_label6 setFont:[UIFont systemFontOfSize:12]];
      _label6.textAlignment = NSTextAlignmentRight;
       [self.contentView addSubview:_label6];
    
       _label7 = [[UILabel alloc]init];
    _label7.frame = CGRectZero;
      [_label7 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label7];
    
       _label8 = [[UILabel alloc]init];
    _label8.frame = CGRectZero;
    _label8.textAlignment = NSTextAlignmentRight;
      [_label8 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label8];
    
            _label9 = [[UILabel alloc]init];
    _label9.frame = CGRectZero;
//    _label9.textAlignment = NSTextAlignmentRight;
      [_label9 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label9];

      _label12 = [[UILabel alloc]init];
    _label12.frame = CGRectZero;
    _label12.textAlignment = NSTextAlignmentRight;
      [_label12 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label12];
    
             _label11 = [[UILabel alloc]init];
    _label11.frame = CGRectZero;
//    _label11.textAlignment = NSTextAlignmentRight;
      [_label11 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label11];
    
              _label12 = [[UILabel alloc]init];
    _label12.frame = CGRectZero;
    _label12.textAlignment = NSTextAlignmentRight;
      [_label12 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label12];
    
                _label13 = [[UILabel alloc]init];
    _label13.frame = CGRectZero;
//    _label13.textAlignment = NSTextAlignmentRight;
      [_label13 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label13];
    
                       _label14 = [[UILabel alloc]init];
    _label14.frame = CGRectZero;
    _label14.textAlignment = NSTextAlignmentRight;
      [_label14 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label14];
    
                           _label15 = [[UILabel alloc]init];
    _label15.frame = CGRectZero;
//    _label15.textAlignment = NSTextAlignmentRight;
      [_label15 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label15];
            _label16 = [[UILabel alloc]init];
    _label16.frame = CGRectZero;
    _label16.textAlignment = NSTextAlignmentRight;
      [_label16 setFont:[UIFont systemFontOfSize:12]];
       [self.contentView addSubview:_label16];
    
    
}

return self;

}
- (void)layoutSubviews{

[super layoutSubviews];

float itemwidth = KScreenWidth-20;
float itemheight = 30;

 CGFloat titleSize = [OAToolBox sizebyText:[NSString stringWithFormat:@"%@",_dic[@"CONTENT"]] font:12 minsWidth:(KScreenWidth-20)*.6];


  CGFloat titleSize2 = [OAToolBox sizebyText:[NSString stringWithFormat:@"%@",_dic[@"FOLLOWSITUATION"]] font:12 minsWidth:(KScreenWidth-20)*.6];

if (titleSize<30) {
    titleSize = 30;
}
else{

 titleSize = titleSize;
}

if (titleSize2<30) {
    titleSize2 = 30;
}
else{

 titleSize2 = titleSize2;
}


_label1.frame =CGRectMake(0, 0, itemwidth*.4, itemheight);
_label2.frame =CGRectMake(_label1.right, 0, itemwidth*.6, itemheight);
_label3.frame =CGRectMake(0, itemheight, itemwidth*.4, itemheight);
_label4.frame =CGRectMake(_label3.right,itemheight, itemwidth*.6, itemheight);
_label5.frame =CGRectMake(0,itemheight*2 , itemwidth*.4, titleSize);
_label6.frame =CGRectMake(_label5.right,itemheight*2 , itemwidth*.6, itemheight);
_label7.frame =CGRectMake(0,itemheight*3 , itemwidth*.4, itemheight);
_label8.frame =CGRectMake(_label7.right,itemheight*3 , itemwidth*.6, itemheight);
_label9.frame =CGRectMake(0,_label7.bottom , itemwidth*.4, titleSize);
_label12.frame =CGRectMake(_label9.right,_label7.bottom , itemwidth*.6, titleSize);
_label11.frame =CGRectMake(0,_label9.bottom , itemwidth*.4, itemheight);
_label12.frame =CGRectMake(_label11.right,_label9.bottom , itemwidth*.6, itemheight);

_label13.frame =CGRectMake(0,_label11.bottom , itemwidth*.4, itemheight);
_label14.frame =CGRectMake(_label13.right,_label11.bottom , itemwidth*.6, itemheight);

_label15.frame =CGRectMake(0,_label13.bottom , itemwidth*.4, titleSize2);
_label16.frame =CGRectMake(_label15.right,_label13.bottom , itemwidth*.6, titleSize2);


_label1.text = @" 企业名称 :";
_label3.text = @" 回访领导 :";
_label5.text = @" 回访人 :";
_label7.text = @" 回访时间 :";
_label9.text = @" 主要内容 :";
_label11.text = @" 跟踪时间 :";
_label13.text = @" 跟踪人 :";
_label15.text = @" 跟踪情况 :";
NSString *string = _dic[@"TIME"];
NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
    fmt.dateFormat = @"MMM d, yyyy HH:mm:ss aa";
 fmt.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en-US"];
     NSDate *date = [fmt dateFromString:string];
     NSDateFormatter *fm = [[NSDateFormatter alloc] init];
    fm.dateFormat = @"yyyy-MM-dd";
     NSString *selfYear = [fm stringFromDate:date];
    
     NSString *string1 = _dic[@"FOLLOWTIME"];
NSDateFormatter *fmt1 = [[NSDateFormatter alloc] init];
    fmt1.dateFormat = @"MMM d, yyyy HH:mm:ss aa";
 fmt1.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en-US"];
     NSDate *date1 = [fmt dateFromString:string1];
     NSDateFormatter *fm1 = [[NSDateFormatter alloc] init];
    fm1.dateFormat = @"yyyy-MM-dd";
     NSString *selfYear1 = [fm1 stringFromDate:date1];
    
_label2.text = [NSString stringWithFormat:@"%@",_dic[@"NAME"]];
_label4.text = [NSString stringWithFormat:@"%@",_dic[@"LEADER"]];
_label6.text = [NSString stringWithFormat:@"%@",_dic[@"PERSON"]];
_label8.text = selfYear;
_label12.text = [NSString stringWithFormat:@"%@",_dic[@"CONTENT"]];
_label12.text = selfYear1;
_label14.text = [NSString stringWithFormat:@"%@",_dic[@"FOLLOWPERSON"]];
_label16.text = [NSString stringWithFormat:@"%@",_dic[@"FOLLOWSITUATION"]];









}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


@end
